﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Se.Framework.Web.Mvc.Filters
{
    public class StaticMethodExecuterInitializerAttribute : InitializerAttribute
    {
        private readonly string methodName;
        private readonly Type type;

        public StaticMethodExecuterInitializerAttribute(Type type, string methodName)
            : base(type.FullName)
        {
            this.methodName = methodName;
            this.type = type;
        }

        protected override void Initialize()
        {
            type.GetMethod(methodName, BindingFlags.Public | BindingFlags.Static).Invoke(null, null);
        }
    }
    
}
